import onnx
from PyCmpltrtok.common import *


def check_model(model_path):
    sep('Load')
    print(model_path)
    model = onnx.load(model_path)
    sep('Check')
    res = onnx.checker.check_model(model)
    print(res)
    sep('Print graph')
    res = onnx.helper.printable_graph(model.graph)
    print(res)


if '__main__' == __name__:

    def _main():
        model_path = '/home/asuspei/PycharmProjects/AsusCondaP37tf24/python_ai/category/onnx/torch2onnx/_save/vgg16_torch2onnx.py/v1.0/2022_06_15_10_05_05_329931.onnx'
        check_model(model_path)

    _main()
